package com.zzy.demo.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

import lombok.extern.slf4j.Slf4j;


/**
 * 
 * @author guokaige
 */
@Slf4j
@Component
public class MyApplicationRunner implements ApplicationRunner {
	
	@Autowired
	Environment env;

    @Override
    public void run(ApplicationArguments var1) throws Exception{
		String host = "localhost";
    	String port= env.getProperty("server.port");
    	String contextPath = env.getProperty("server.servlet.context-path");
		log.info("---------启动成功,访问首页: http://{}:{}{}/",host,port,contextPath);
		log.info("---------启动成功,访问druid: http://{}:{}{}/druid",host,port,contextPath);
		log.info("---------启动成功,访问swagger: http://{}:{}{}/swagger-ui.html",host,port,contextPath);
    }
}